import request from './request'

//获取收藏 关注 动态数量
export function getUnitCount(type,uid){
    return request({
        url:'/unit/count/'+uid,
        params:{
            type
        }
    })
}

//获取收藏列表
export function getCollectionList(uid,type){
    return request({
        url:'/collection/collection/'+uid,
        params:{
            type
        }
    })
}

//删除已删除动态的收藏
export function delCollection(id){
    return request({
        url:'/collection/delCollection/'+id,
        method:'delete'
    })
}

//获取用户个人信息
// export function getArchives(type,uid){
//     return request({
//         url:'/unit/archives',
//         params:{
//             type,uid
//         }
//     })
// }

//获取关注列表
export function getConcernList(uid,type){
    return request({
        url:'/concern/concern/'+uid,
        params:{
            type
        }
    })
}

//添加关注
export function addConcern(concern){
    return request({
        url:'/concern/concern',
        method:'post',
        data:concern
    })
}

//取消关注
export function cancelConcern(concern){
    return request({
        url:'/concern/concern',
        method:'delete',
        data:concern
    })
}

//个人信息展示
export function getArchives(type,uid,isMyself){        //传isMyself表示自己看
    return request({
        url:'/unit/archives',
        params:{
            type,uid,isMyself
        }
    })
}

//修改单位的动态是否可见
export function dynamicVisible(id,type){
    return request({
        url:'/dynamic/unitVisible/'+id,
        method:'put',
        params:{
            type
        }
    })
}

//个人信息是否可见开关
export function archivesVisible(id,type){       //用户id,type
    return request({
        url:'/unit/archivesVisible/'+id,
        method:'put',
        params:{
            type
        }
    })
}

//退出登录
export function logout(){
    return request({
        url:'/logout'
    })
}


//修改密码
export function changePassWord(id,newPwd,oldPwd,type){
    return request({
        url:'/unit/updatePwd/'+id,
        method:'put',
        params:{
            newPwd,oldPwd,type
        }
    })
}


//搜索用户
export function searchUser(name){
    return request({
        url:'/unit/searchUnit',
        params:{
            name
        }
    })
}

//获取关注我的人
export function getConcernMine(type,uId){
    return request({
        url:'/concern/concernMine',
        params:{
            type,uId
        }
    })
}

//获取热度比例
export function getHotProportion(id,type){
    return request({
        url:'/unit/hotProportion/'+id,
        params:{
            type
        }
    })
}


//找回密码发送邮箱验证码
export function getForgetCaptcha(forget){
    return request({
        url:'/forget',
        method:'post',
        data:forget
    })
}

//重设密码
export function reSetPwd(forget){
    return request({
        url:'/upPassword',
        method:'post',
        data:forget
    })
}


//学生更新信息
export function upStudent(student){
    return request({
        url:'/student',
        method:'put',
        data:student
    })
}

//大学更新信息
export function upUniversity(university){
    return request({
        url:'/university/university',
        method:'put',
        data:university
    })
}

//更新企业信息
export function upCompany(company){
    return request({
        url:'/company',
        method:'put',
        data:company
    })
}
